<%@page import="org.apache.taglibs.standard.lang.jpath.adapter.Convert"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page import = "com.classes.Casemast, java.util.ArrayList, java.util.TreeMap, org.owasp.encoder.Encode" %>
<%@ page import = "com.mbbmap.security.dao.*" %>
<%@ include file="/jsp/map/include/user-dao.jsp" %>
<%@page import="com.mbbmap.util.EncryptionHelper"%>	
<%

TreeMap<String, String> search = (TreeMap<String, String>) request.getAttribute("search");

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<jsp:include page="/jsp/map/include/html-meta.jsp" />
<title>MAYBANK</title>
<script src="<%= request.getContextPath() %>/js/report.js"></script>
</head>

<body onload="report.report_init();">

<!-- Header -->
<%@ include file="/jsp/common/Header.jsp" %>	
<!-- End Header -->


<div class="row-fluid page" style="width:1200px; max-width:none;">
	<div class="span12">
		
		<jsp:include page="/jsp/map/include/report-nav.jsp">
			<jsp:param name="report_title" value='<%=EncryptionHelper.encrypt("Summary Report") %>' />
		</jsp:include>

		<form name="search_form" method="post" action="<%= request.getContextPath() + "/Report.do?dispatch=summary_report" %>" onsubmit="return report.search_status_validate();">
			<div class="row-fluid form-horizontal search">
				<div class="span6">
				
					<div class="control-group">
						<label class="control-label">Application Type</label>
						<div class="controls">
							<select id="application_type" name="application_type" onchange="report.change_matrix()">
							<% 
								String html = "<option value=\"\"></option>"
									+ "<option value=\"New Application\">New Application</option>"
									+ "<option value=\"Extend Facility\">Extend Facility</option>"
									+ "<option value=\"e-Commerce/M2u\">e-Commerce/M2u</option>"
									+ "<option value=\"Additional Terminal/mPOS Reader\">Additional Terminal/mPOS Reader</option>";
									
								if(search.containsKey("application_type") && search.get("application_type").length() > 0){
									html = html.replace("value=\"" + search.get("application_type") + "\"", "value=\"" + search.get("application_type") + "\" selected ");
								}
								
								out.println(html);
							%>
							</select>
						</div>
					</div>
					
					<div class="control-group">
						<label class="control-label">Monthly</label>
						<div class="controls">
							<%
							html = "";
							if(search.containsKey("year")){
								html = search.get("year");
							}
							%>
							<input type="text" id="year" name="year" placeholder="eg. 2015" value="<%= html %>" />
							
							<select id="month" name="month">
							<% 
								html = "<option value=\"\"></option>"
									+ "<option value=\"01\">JANUARY</option>"
									+ "<option value=\"02\">FEBRUARY</option>"
									+ "<option value=\"03\">MARCH</option>"
									+ "<option value=\"04\">APRIL</option>"
									+ "<option value=\"05\">MAY</option>"
									+ "<option value=\"06\">JUNE</option>"
									+ "<option value=\"07\">JULY</option>"
									+ "<option value=\"08\">AUGUST</option>"
									+ "<option value=\"09\">SEPTEMBER</option>"
									+ "<option value=\"10\">OCTOBER</option>"
									+ "<option value=\"11\">NOVEMBER</option>"
									+ "<option value=\"12\">DECEMBER</option>";
									
								if(search.containsKey("month") && search.get("month").length() > 0){
									html = html.replace("value=\"" + search.get("month") + "\"", "value=\"" + search.get("month") + "\" selected ");
								}
								
								out.println(html);
							%>
							</select>
						</div>
					</div>
					
				</div>
				
				<div class="span6">
				
					<div class="control-group">
						<label class="control-label">Matrix</label>
						<div class="controls">
							<select id="matrix" name="matrix" disabled="disabled">
							<% 
								html = "<option value=\"\"></option>"
									+ "<option value=\"Matrix\">Matrix</option>"
									+ "<option value=\"Non Matrix\">Non Matrix</option>"
									+ "<option value=\"Other\">Other</option>";
								
								if(search.containsKey("matrix") && search.get("matrix").length() > 0){
									html = html.replace("value=\"" + search.get("matrix") + "\"", "value=\"" + search.get("matrix") + "\" selected ");
								}
								
								out.println(html);
							%>
							</select>
						</div>
					</div>
					
					<div class="control-group">
						<label class="control-label">Daily</label>
						
						<div class="controls">
							<%
							html = "";
							if(search.containsKey("from_date")){
								html = search.get("from_date");
							}
							%>
							<input type="text" id="from_date" name="from_date" placeholder="eg. 23/01/2015" value="<%= html %>" />
							
							<%
							html = "";
							if(search.containsKey("to_date")){
								html = search.get("to_date");
							}
							%>
							<input type="text" id="to_date" name="to_date" placeholder="eg. 09/02/2015" value="<%= html %>" />
						</div>
					</div>
					
				</div>
			</div>
			
			<div class="row-fluid">
				<div class="span12 btn-control search">
					<button id="search_submit" name="search_submit" type="submit" class="btn">Search</button>
					<button id="search_clear" name="search_clear" type="submit" class="btn">Clear</button>
					<button id="export_submit" name="export_submit" type="submit" class="btn">Export</button>
				</div>
			</div>
			
		</form>
		<!-- New App - Non Matrix  -->
		<%
			TreeMap<String, ArrayList<TreeMap<String, String>>> t = (TreeMap<String, ArrayList<TreeMap<String, String>>>) request.getAttribute("tArr");
			if(t != null && t.size() > 0){
				ArrayList<TreeMap<String, String>> cArrNewAppNonMatrix = t.get("New Application Non Matrix");
				if(cArrNewAppNonMatrix != null && cArrNewAppNonMatrix.size() > 0){
					
					html = "<div style="+"width:1200px; overflow-x:auto" +">"
						+ "<table class=" + "tblDetails reportTbl" +"><thead>"
						+ "<tr>"
						+ "<th rowspan="+ "2" + " >Group</th>"
						+ "<th rowspan="+ "2" +">Total Submission</th>"
						+ "<th colspan=" + "12" + " style=" + "text-align:center" + ">Application Type - New (Non Matrix)</th>"	
						+ "</tr>"
						+ "<tr>"
						+ "<th>Pre-Approved</th>"
						+ "<th>Document and Credit Check</th>"
						+ "<th>Decisioning</th>"
						+ "<th>Approve, to issue New Letter of Acceptance</th>"
						+ "<th>Approved. Request for MID Setup</th>"
						+ "<th>Decline</th>"
						+ "<th>Close-Cancel</th>"
						+ "<th>Close-Withdrawn</th>"
						+ "<th>Pending Verification </th>"
						+ "<th>Pending Installation</th>"
						+ "<th>Terminal Installed</th>"
						+ "<th>Total</th>"
						+ "</tr>"
						+"</thead><tbody>";
					
					int n = 0;
					int sum_TotalSubmission = 0;
					int sum_c = 0;
					int sum_d = 0;
					int sum_e = 0;
					int sum_f = 0;
					int sum_g = 0;
					int sum_h = 0;
					int sum_i = 0;
					int sum_j = 0;
					int sum_k = 0;
					int sum_l = 0;
					int sum_m = 0;
					int sum_TotalWork = 0;
					
					for(TreeMap<String, String> c : (ArrayList<TreeMap<String, String>>) cArrNewAppNonMatrix){
						sum_TotalSubmission += c.get("total_submission") != null ?Integer.parseInt(c.get("total_submission")): 0;
						sum_c += c.get("col_c") != null ? Integer.parseInt(c.get("col_c")): 0;
						sum_d += c.get("col_d") != null ? Integer.parseInt(c.get("col_d")): 0;
						sum_e += c.get("col_e") != null ? Integer.parseInt(c.get("col_e")): 0;
						sum_f += c.get("col_f") != null ? Integer.parseInt(c.get("col_f")): 0;
						sum_g += c.get("col_g") != null ? Integer.parseInt(c.get("col_g")): 0;
						sum_h += c.get("col_h") != null ? Integer.parseInt(c.get("col_h")): 0;
						sum_i += c.get("col_i") != null ? Integer.parseInt(c.get("col_i")): 0;
						sum_j += c.get("col_j") != null ? Integer.parseInt(c.get("col_j")): 0;
						sum_k += c.get("col_k") != null ? Integer.parseInt(c.get("col_k")): 0;
						sum_l += c.get("col_l") != null ? Integer.parseInt(c.get("col_l")): 0;
						sum_m += c.get("col_m") != null ? Integer.parseInt(c.get("col_m")): 0;
						sum_TotalWork += c.get("total") != null ? Integer.parseInt(c.get("total")): 0;
						
						html += "<tr class=" + (n % 2 > 0 ? "alt" : "even") + ">"
						+ "	<td>" + (c.get("group") != null ? Encode.forHtml(c.get("group")) : "") + "</td>"
						+ "	<td>" + (c.get("total_submission") != null ? Encode.forHtml(c.get("total_submission")) : "") + "</td>"
						+ "	<td>" + (c.get("col_c") != null ? Encode.forHtml(c.get("col_c")) : "") + "</td>"
						+ "	<td>" + (c.get("col_d") != null ? Encode.forHtml(c.get("col_d")) : "") + "</td>"
						+ "	<td>" + (c.get("col_e") != null ? Encode.forHtml(c.get("col_e")) : "") + "</td>"
						+ "	<td>" + (c.get("col_f") != null ? Encode.forHtml(c.get("col_f")) : "") + "</td>"
						+ "	<td>" + (c.get("col_g") != null ? Encode.forHtml(c.get("col_g")) : "") + "</td>"
						+ "	<td>" + (c.get("col_h") != null ? Encode.forHtml(c.get("col_h")) : "") + "</td>"
						+ "	<td>" + (c.get("col_i") != null ? Encode.forHtml(c.get("col_i")) : "") + "</td>"
						+ "	<td>" + (c.get("col_j") != null ? Encode.forHtml(c.get("col_j")) : "")  + "</td>"
						+ "	<td>" + (c.get("col_k") != null ? Encode.forHtml(c.get("col_k")) : "")  + "</td>"
						+ "	<td>" + (c.get("col_l") != null ? Encode.forHtml(c.get("col_l")) : "")  + "</td>"
						+ "	<td>" + (c.get("col_m") != null ? Encode.forHtml(c.get("col_m")) : "")  + "</td>"
						+ "	<td>" + (c.get("total") != null ? Encode.forHtml(c.get("total")) : "")  + "</td>"
						+ "</tr>";
						
						++n;
					}
					html += "<tr class=" + (n % 2 > 0 ? "alt" : "even") + ">";
					html += "<td>Total</td>";
					html += "<td>"+sum_TotalSubmission+"</td>";
					html += "<td>"+sum_c+"</td>";
					html += "<td>"+sum_d+"</td>";
					html += "<td>"+sum_e+"</td>";
					html += "<td>"+sum_f+"</td>";
					html += "<td>"+sum_g+"</td>";
					html += "<td>"+sum_h+"</td>";
					html += "<td>"+sum_i+"</td>";
					html += "<td>"+sum_j+"</td>";
					html += "<td>"+sum_k+"</td>";
					html += "<td>"+sum_l+"</td>";
					html += "<td>"+sum_m+"</td>";
					html += "<td>"+sum_TotalWork+"</td></tr>";
						
					html +="</tbody></table></div>";
					out.println(html);
				}
		%>
		<!-- New App - Matrix  -->
		<%
			ArrayList<TreeMap<String, String>> cArrNewAppMatrix = t.get("New Application Matrix");
			if(cArrNewAppMatrix != null && cArrNewAppMatrix.size() > 0){
				
				html = "<div style="+"width:1200px; overflow-x:auto" +">"
					+ "<table class=" + "tblDetails reportTbl" +"><thead>"
					+ "<tr>"
					+ "<th rowspan="+ "2" + " >Group</th>"
					+ "<th rowspan="+ "2" +">Total Submission</th>"
					+ "<th colspan=" + "12" + " style=" + "text-align:center" + ">Application Type - New (Matrix)</th>"	
					+ "</tr>"
					+ "<tr>"
					+ "<th>Pre-Approved</th>"
					+ "<th>Document and Credit Check</th>"
					+ "<th>Decisioning</th>"
					+ "<th>Approve, to issue New Letter of Acceptance</th>"
					+ "<th>Approved. Request for MID Setup</th>"
					+ "<th>Decline</th>"
					+ "<th>Close-Cancel</th>"
					+ "<th>Close-Withdrawn</th>"
					+ "<th>Pending Verification </th>"
					+ "<th>Pending Installation</th>"
					+ "<th>Terminal Installed</th>"
					+ "<th>Total</th>"
					+ "</tr>"
					+"</thead><tbody>";
				
				int n = 0;
				int sum_TotalSubmission = 0;
				int sum_c = 0;
				int sum_d = 0;
				int sum_e = 0;
				int sum_f = 0;
				int sum_g = 0;
				int sum_h = 0;
				int sum_i = 0;
				int sum_j = 0;
				int sum_k = 0;
				int sum_l = 0;
				int sum_m = 0;
				int sum_TotalWork = 0;
				
				for(TreeMap<String, String> c : (ArrayList<TreeMap<String, String>>) cArrNewAppMatrix){
					sum_TotalSubmission += c.get("total_submission") != null ?Integer.parseInt(c.get("total_submission")): 0;
					sum_c += c.get("col_c") != null ? Integer.parseInt(c.get("col_c")): 0;
					sum_d += c.get("col_d") != null ? Integer.parseInt(c.get("col_d")): 0;
					sum_e += c.get("col_e") != null ? Integer.parseInt(c.get("col_e")): 0;
					sum_f += c.get("col_f") != null ? Integer.parseInt(c.get("col_f")): 0;
					sum_g += c.get("col_g") != null ? Integer.parseInt(c.get("col_g")): 0;
					sum_h += c.get("col_h") != null ? Integer.parseInt(c.get("col_h")): 0;
					sum_i += c.get("col_i") != null ? Integer.parseInt(c.get("col_i")): 0;
					sum_j += c.get("col_j") != null ? Integer.parseInt(c.get("col_j")): 0;
					sum_k += c.get("col_k") != null ? Integer.parseInt(c.get("col_k")): 0;
					sum_l += c.get("col_l") != null ? Integer.parseInt(c.get("col_l")): 0;
					sum_m += c.get("col_m") != null ? Integer.parseInt(c.get("col_m")): 0;
					sum_TotalWork += c.get("total") != null ? Integer.parseInt(c.get("total")): 0;
					
					html += "<tr class=" + (n % 2 > 0 ? "alt" : "even") + ">"
					+ "	<td>" + (c.get("group") != null ? Encode.forHtml(c.get("group")) : "") + "</td>"
					+ "	<td>" + (c.get("total_submission") != null ? Encode.forHtml(c.get("total_submission")) : "") + "</td>"
					+ "	<td>" + (c.get("col_c") != null ? Encode.forHtml(c.get("col_c")) : "") + "</td>"
					+ "	<td>" + (c.get("col_d") != null ? Encode.forHtml(c.get("col_d")) : "") + "</td>"
					+ "	<td>" + (c.get("col_e") != null ? Encode.forHtml(c.get("col_e")) : "") + "</td>"
					+ "	<td>" + (c.get("col_f") != null ? Encode.forHtml(c.get("col_f")) : "") + "</td>"
					+ "	<td>" + (c.get("col_g") != null ? Encode.forHtml(c.get("col_g")) : "") + "</td>"
					+ "	<td>" + (c.get("col_h") != null ? Encode.forHtml(c.get("col_h")) : "") + "</td>"
					+ "	<td>" + (c.get("col_i") != null ? Encode.forHtml(c.get("col_i")) : "") + "</td>"
					+ "	<td>" + (c.get("col_j") != null ? Encode.forHtml(c.get("col_j")) : "")  + "</td>"
					+ "	<td>" + (c.get("col_k") != null ? Encode.forHtml(c.get("col_k")) : "")  + "</td>"
					+ "	<td>" + (c.get("col_l") != null ? Encode.forHtml(c.get("col_l")) : "")  + "</td>"
					+ "	<td>" + (c.get("col_m") != null ? Encode.forHtml(c.get("col_m")) : "")  + "</td>"
					+ "	<td>" + (c.get("total") != null ? Encode.forHtml(c.get("total")) : "")  + "</td>"
					+ "</tr>";
					
					++n;
				}
				html += "<tr class=" + (n % 2 > 0 ? "alt" : "even") + ">";
				html += "<td>Total</td>";
				html += "<td>"+sum_TotalSubmission+"</td>";
				html += "<td>"+sum_c+"</td>";
				html += "<td>"+sum_d+"</td>";
				html += "<td>"+sum_e+"</td>";
				html += "<td>"+sum_f+"</td>";
				html += "<td>"+sum_g+"</td>";
				html += "<td>"+sum_h+"</td>";
				html += "<td>"+sum_i+"</td>";
				html += "<td>"+sum_j+"</td>";
				html += "<td>"+sum_k+"</td>";
				html += "<td>"+sum_l+"</td>";
				html += "<td>"+sum_m+"</td>";
				html += "<td>"+sum_TotalWork+"</td></tr>";
				html +="</tbody></table></div>";
				out.println(html);
			}
		%>
		<!-- New App - Other -->
		<%
			ArrayList<TreeMap<String, String>> cArrNewAppOther = t.get("New Application Other");
			if(cArrNewAppOther != null && cArrNewAppOther.size() > 0){
				
				html = "<div style="+"width:1200px; overflow-x:auto" +">"
					+ "<table class=" + "tblDetails reportTbl" +"><thead>"
					+ "<tr>"
					+ "<th rowspan="+ "2" + " >Group</th>"
					+ "<th rowspan="+ "2" +">Total Submission</th>"
					+ "<th colspan=" + "12" + " style=" + "text-align:center" + ">Application Type - New (Other)</th>"	
					+ "</tr>"
					+ "<tr>"
					+ "<th>Pre-Approved</th>"
					+ "<th>Document and Credit Check</th>"
					+ "<th>Decisioning</th>"
					+ "<th>Approve, to issue New Letter of Acceptance</th>"
					+ "<th>Approved. Request for MID Setup</th>"
					+ "<th>Decline</th>"
					+ "<th>Close-Cancel</th>"
					+ "<th>Close-Withdrawn</th>"
					+ "<th>Pending Verification </th>"
					+ "<th>Pending Installation</th>"
					+ "<th>Terminal Installed</th>"
					+ "<th>Total</th>"
					+ "</tr>"
					+"</thead><tbody>";
				
				int n = 0;
				int sum_TotalSubmission = 0;
				int sum_c = 0;
				int sum_d = 0;
				int sum_e = 0;
				int sum_f = 0;
				int sum_g = 0;
				int sum_h = 0;
				int sum_i = 0;
				int sum_j = 0;
				int sum_k = 0;
				int sum_l = 0;
				int sum_m = 0;
				int sum_TotalWork = 0;
				
				for(TreeMap<String, String> c : (ArrayList<TreeMap<String, String>>) cArrNewAppOther){
					sum_TotalSubmission += c.get("total_submission") != null ?Integer.parseInt(c.get("total_submission")): 0;
					sum_c += c.get("col_c") != null ? Integer.parseInt(c.get("col_c")): 0;
					sum_d += c.get("col_d") != null ? Integer.parseInt(c.get("col_d")): 0;
					sum_e += c.get("col_e") != null ? Integer.parseInt(c.get("col_e")): 0;
					sum_f += c.get("col_f") != null ? Integer.parseInt(c.get("col_f")): 0;
					sum_g += c.get("col_g") != null ? Integer.parseInt(c.get("col_g")): 0;
					sum_h += c.get("col_h") != null ? Integer.parseInt(c.get("col_h")): 0;
					sum_i += c.get("col_i") != null ? Integer.parseInt(c.get("col_i")): 0;
					sum_j += c.get("col_j") != null ? Integer.parseInt(c.get("col_j")): 0;
					sum_k += c.get("col_k") != null ? Integer.parseInt(c.get("col_k")): 0;
					sum_l += c.get("col_l") != null ? Integer.parseInt(c.get("col_l")): 0;
					sum_m += c.get("col_m") != null ? Integer.parseInt(c.get("col_m")): 0;
					sum_TotalWork += c.get("total") != null ? Integer.parseInt(c.get("total")): 0;
					
					html += "<tr class=" + (n % 2 > 0 ? "alt" : "even") + ">"
					+ "	<td>" + (c.get("group") != null ? Encode.forHtml(c.get("group")) : "") + "</td>"
					+ "	<td>" + (c.get("total_submission") != null ? Encode.forHtml(c.get("total_submission")) : "") + "</td>"
					+ "	<td>" + (c.get("col_c") != null ? Encode.forHtml(c.get("col_c")) : "") + "</td>"
					+ "	<td>" + (c.get("col_d") != null ? Encode.forHtml(c.get("col_d")) : "") + "</td>"
					+ "	<td>" + (c.get("col_e") != null ? Encode.forHtml(c.get("col_e")) : "") + "</td>"
					+ "	<td>" + (c.get("col_f") != null ? Encode.forHtml(c.get("col_f")) : "") + "</td>"
					+ "	<td>" + (c.get("col_g") != null ? Encode.forHtml(c.get("col_g")) : "") + "</td>"
					+ "	<td>" + (c.get("col_h") != null ? Encode.forHtml(c.get("col_h")) : "") + "</td>"
					+ "	<td>" + (c.get("col_i") != null ? Encode.forHtml(c.get("col_i")) : "") + "</td>"
					+ "	<td>" + (c.get("col_j") != null ? Encode.forHtml(c.get("col_j")) : "")  + "</td>"
					+ "	<td>" + (c.get("col_k") != null ? Encode.forHtml(c.get("col_k")) : "")  + "</td>"
					+ "	<td>" + (c.get("col_l") != null ? Encode.forHtml(c.get("col_l")) : "")  + "</td>"
					+ "	<td>" + (c.get("col_m") != null ? Encode.forHtml(c.get("col_m")) : "")  + "</td>"
					+ "	<td>" + (c.get("total") != null ? Encode.forHtml(c.get("total")) : "")  + "</td>"
					+ "</tr>";
					
					++n;
				}
				html += "<tr class=" + (n % 2 > 0 ? "alt" : "even") + ">";
				html += "<td>Total</td>";
				html += "<td>"+sum_TotalSubmission+"</td>";
				html += "<td>"+sum_c+"</td>";
				html += "<td>"+sum_d+"</td>";
				html += "<td>"+sum_e+"</td>";
				html += "<td>"+sum_f+"</td>";
				html += "<td>"+sum_g+"</td>";
				html += "<td>"+sum_h+"</td>";
				html += "<td>"+sum_i+"</td>";
				html += "<td>"+sum_j+"</td>";
				html += "<td>"+sum_k+"</td>";
				html += "<td>"+sum_l+"</td>";
				html += "<td>"+sum_m+"</td>";
				html += "<td>"+sum_TotalWork+"</td></tr>";
				html +="</tbody></table></div>";
				out.println(html);
			}
		%>
		<!-- Extend Facility -->
		<%
			ArrayList<TreeMap<String, String>> cArrExtend = t.get("Extend Facility");
			if(cArrExtend != null && cArrExtend.size() > 0){
				
				html = "<div style="+"width:1200px; overflow-x:auto" +">"
					+ "<table class=" + "tblDetails reportTbl" +"><thead>"
					+ "<tr>"
					+ "<th rowspan="+ "2" + " >Group</th>"
					+ "<th rowspan="+ "2" +">Total Submission</th>"
					+ "<th colspan=" + "12" + " style=" + "text-align:center" + ">Application Type - Extend Facility</th>"	
					+ "</tr>"
					+ "<tr>"
					+ "<th>Pre-Approved</th>"
					+ "<th>Document and Credit Check</th>"
					+ "<th>Decisioning</th>"
					+ "<th>Approve, to issue New Letter of Acceptance</th>"
					+ "<th>Approved. Request for MID Setup</th>"
					+ "<th>Decline</th>"
					+ "<th>Close-Cancel</th>"
					+ "<th>Close-Withdrawn</th>"
					+ "<th>Pending Verification </th>"
					+ "<th>Pending Installation</th>"
					+ "<th>Terminal Installed</th>"
					+ "<th>Total</th>"
					+ "</tr>"
					+"</thead><tbody>";
				
				int n = 0;
				int sum_TotalSubmission = 0;
				int sum_c = 0;
				int sum_d = 0;
				int sum_e = 0;
				int sum_f = 0;
				int sum_g = 0;
				int sum_h = 0;
				int sum_i = 0;
				int sum_j = 0;
				int sum_k = 0;
				int sum_l = 0;
				int sum_m = 0;
				int sum_TotalWork = 0;
				
				for(TreeMap<String, String> c : (ArrayList<TreeMap<String, String>>) cArrExtend){
					sum_TotalSubmission += c.get("total_submission") != null ?Integer.parseInt(c.get("total_submission")): 0;
					sum_c += c.get("col_c") != null ? Integer.parseInt(c.get("col_c")): 0;
					sum_d += c.get("col_d") != null ? Integer.parseInt(c.get("col_d")): 0;
					sum_e += c.get("col_e") != null ? Integer.parseInt(c.get("col_e")): 0;
					sum_f += c.get("col_f") != null ? Integer.parseInt(c.get("col_f")): 0;
					sum_g += c.get("col_g") != null ? Integer.parseInt(c.get("col_g")): 0;
					sum_h += c.get("col_h") != null ? Integer.parseInt(c.get("col_h")): 0;
					sum_i += c.get("col_i") != null ? Integer.parseInt(c.get("col_i")): 0;
					sum_j += c.get("col_j") != null ? Integer.parseInt(c.get("col_j")): 0;
					sum_k += c.get("col_k") != null ? Integer.parseInt(c.get("col_k")): 0;
					sum_l += c.get("col_l") != null ? Integer.parseInt(c.get("col_l")): 0;
					sum_m += c.get("col_m") != null ? Integer.parseInt(c.get("col_m")): 0;
					sum_TotalWork += c.get("total") != null ? Integer.parseInt(c.get("total")): 0;
					
					html += "<tr class=" + (n % 2 > 0 ? "alt" : "even") + ">"
					+ "	<td>" + (c.get("group") != null ? Encode.forHtml(c.get("group")) : "") + "</td>"
					+ "	<td>" + (c.get("total_submission") != null ? Encode.forHtml(c.get("total_submission")) : "") + "</td>"
					+ "	<td>" + (c.get("col_c") != null ? Encode.forHtml(c.get("col_c")) : "") + "</td>"
					+ "	<td>" + (c.get("col_d") != null ? Encode.forHtml(c.get("col_d")) : "") + "</td>"
					+ "	<td>" + (c.get("col_e") != null ? Encode.forHtml(c.get("col_e")) : "") + "</td>"
					+ "	<td>" + (c.get("col_f") != null ? Encode.forHtml(c.get("col_f")) : "") + "</td>"
					+ "	<td>" + (c.get("col_g") != null ? Encode.forHtml(c.get("col_g")) : "") + "</td>"
					+ "	<td>" + (c.get("col_h") != null ? Encode.forHtml(c.get("col_h")) : "") + "</td>"
					+ "	<td>" + (c.get("col_i") != null ? Encode.forHtml(c.get("col_i")) : "") + "</td>"
					+ "	<td>" + (c.get("col_j") != null ? Encode.forHtml(c.get("col_j")) : "")  + "</td>"
					+ "	<td>" + (c.get("col_k") != null ? Encode.forHtml(c.get("col_k")) : "")  + "</td>"
					+ "	<td>" + (c.get("col_l") != null ? Encode.forHtml(c.get("col_l")) : "")  + "</td>"
					+ "	<td>" + (c.get("col_m") != null ? Encode.forHtml(c.get("col_m")) : "")  + "</td>"
					+ "	<td>" + (c.get("total") != null ? Encode.forHtml(c.get("total")) : "")  + "</td>"
					+ "</tr>";
					
					++n;
				}
				html += "<tr class=" + (n % 2 > 0 ? "alt" : "even") + ">";
				html += "<td>Total</td>";
				html += "<td>"+sum_TotalSubmission+"</td>";
				html += "<td>"+sum_c+"</td>";
				html += "<td>"+sum_d+"</td>";
				html += "<td>"+sum_e+"</td>";
				html += "<td>"+sum_f+"</td>";
				html += "<td>"+sum_g+"</td>";
				html += "<td>"+sum_h+"</td>";
				html += "<td>"+sum_i+"</td>";
				html += "<td>"+sum_j+"</td>";
				html += "<td>"+sum_k+"</td>";
				html += "<td>"+sum_l+"</td>";
				html += "<td>"+sum_m+"</td>";
				html += "<td>"+sum_TotalWork+"</td></tr>";
				html +="</tbody></table></div>";
				out.println(html);
			}
		%>
		<!-- e-Commerce/M2u -->
		<%
			ArrayList<TreeMap<String, String>> cArrECommerce = t.get("e-Commerce/M2u");
			if(cArrECommerce != null && cArrECommerce.size() > 0){
				
				html = "<div style="+"width:1200px; overflow-x:auto" +">"
				+ "<table class=" + "tblDetails reportTbl" +"><thead>"
				+ "<tr>"
				+ "<th rowspan="+ "2" + " >Group</th>"
				+ "<th rowspan="+ "2" +">Total Submission</th>"
				+ "<th colspan=" + "12" + " style=" + "text-align:center" + ">Application Type - e-Commerce/M2u</th>"	
				+ "</tr>"
				+ "<tr>"
				+ "<th>Pre-Approved</th>"
				+ "<th>Document and Credit Check</th>"
				+ "<th>Decisioning</th>"
				+ "<th>Approve, to issue New Letter of Acceptance</th>"
				+ "<th>Approved. Request for MID Setup</th>"
				+ "<th>Decline</th>"
				+ "<th>Close-Cancel</th>"
				+ "<th>Close-Withdrawn</th>"
				+ "<th>Pending Verification </th>"
				+ "<th>Pending Installation</th>"
				+ "<th>Terminal Installed</th>"
				+ "<th>Total</th>"
				+ "</tr>"
				+"</thead><tbody>";
				
					int n = 0;
					int sum_TotalSubmission = 0;
					int sum_c = 0;
					int sum_d = 0;
					int sum_e = 0;
					int sum_f = 0;
					int sum_g = 0;
					int sum_h = 0;
					int sum_i = 0;
					int sum_j = 0;
					int sum_k = 0;
					int sum_l = 0;
					int sum_m = 0;
					int sum_TotalWork = 0;
					
					for(TreeMap<String, String> c : (ArrayList<TreeMap<String, String>>) cArrECommerce){
						sum_TotalSubmission += c.get("total_submission") != null ?Integer.parseInt(c.get("total_submission")): 0;
						sum_c += c.get("col_c") != null ? Integer.parseInt(c.get("col_c")): 0;
						sum_d += c.get("col_d") != null ? Integer.parseInt(c.get("col_d")): 0;
						sum_e += c.get("col_e") != null ? Integer.parseInt(c.get("col_e")): 0;
						sum_f += c.get("col_f") != null ? Integer.parseInt(c.get("col_f")): 0;
						sum_g += c.get("col_g") != null ? Integer.parseInt(c.get("col_g")): 0;
						sum_h += c.get("col_h") != null ? Integer.parseInt(c.get("col_h")): 0;
						sum_i += c.get("col_i") != null ? Integer.parseInt(c.get("col_i")): 0;
						sum_j += c.get("col_j") != null ? Integer.parseInt(c.get("col_j")): 0;
						sum_k += c.get("col_k") != null ? Integer.parseInt(c.get("col_k")): 0;
						sum_l += c.get("col_l") != null ? Integer.parseInt(c.get("col_l")): 0;
						sum_m += c.get("col_m") != null ? Integer.parseInt(c.get("col_m")): 0;
						sum_TotalWork += c.get("total") != null ? Integer.parseInt(c.get("total")): 0;
						
						
						html += "<tr class=" + (n % 2 > 0 ? "alt" : "even") + ">"
						+ "	<td>" + (c.get("group") != null ? Encode.forHtml(c.get("group")) : "") + "</td>"
						+ "	<td>" + (c.get("total_submission") != null ? Encode.forHtml(c.get("total_submission")) : "") + "</td>"
						+ "	<td>" + (c.get("col_c") != null ? Encode.forHtml(c.get("col_c")) : "") + "</td>"
						+ "	<td>" + (c.get("col_d") != null ? Encode.forHtml(c.get("col_d")) : "") + "</td>"
						+ "	<td>" + (c.get("col_e") != null ? Encode.forHtml(c.get("col_e")) : "") + "</td>"
						+ "	<td>" + (c.get("col_f") != null ? Encode.forHtml(c.get("col_f")) : "") + "</td>"
						+ "	<td>" + (c.get("col_g") != null ? Encode.forHtml(c.get("col_g")) : "") + "</td>"
						+ "	<td>" + (c.get("col_h") != null ? Encode.forHtml(c.get("col_h")) : "") + "</td>"
						+ "	<td>" + (c.get("col_i") != null ? Encode.forHtml(c.get("col_i")) : "") + "</td>"
						+ "	<td>" + (c.get("col_j") != null ? Encode.forHtml(c.get("col_j")) : "")  + "</td>"
						+ "	<td>" + (c.get("col_k") != null ? Encode.forHtml(c.get("col_k")) : "")  + "</td>"
						+ "	<td>" + (c.get("col_l") != null ? Encode.forHtml(c.get("col_l")) : "")  + "</td>"
						+ "	<td>" + (c.get("col_m") != null ? Encode.forHtml(c.get("col_m")) : "")  + "</td>"
						+ "	<td>" + (c.get("total") != null ? Encode.forHtml(c.get("total")) : "")  + "</td>"
						+ "</tr>";
						
						++n;
					}
					html += "<tr class=" + (n % 2 > 0 ? "alt" : "even") + ">";
					html += "<td>Total</td>";
					html += "<td>"+sum_TotalSubmission+"</td>";
					html += "<td>"+sum_c+"</td>";
					html += "<td>"+sum_d+"</td>";
					html += "<td>"+sum_e+"</td>";
					html += "<td>"+sum_f+"</td>";
					html += "<td>"+sum_g+"</td>";
					html += "<td>"+sum_h+"</td>";
					html += "<td>"+sum_i+"</td>";
					html += "<td>"+sum_j+"</td>";
					html += "<td>"+sum_k+"</td>";
					html += "<td>"+sum_l+"</td>";
					html += "<td>"+sum_m+"</td>";
					html += "<td>"+sum_TotalWork+"</td></tr>";
					html +="</tbody></table></div>";
					out.println(html);
				}
		%>
		<!-- Additional Terminal/mPOS Reader -->
		<%
			ArrayList<TreeMap<String, String>> cArrAddtion = t.get("Additional Terminal/mPOS Reader");
			if(cArrAddtion != null && cArrAddtion.size() > 0){
		
				html = "<div style="+"width:1200px; overflow-x:auto" +">"
					+ "<table class=" + "tblDetails reportTbl" +"><thead>"
					+ "<tr>"
					+ "<th rowspan="+ "2" + " >Group</th>"
					+ "<th rowspan="+ "2" +">Total Submission</th>"
					+ "<th colspan=" + "12" + " style=" + "text-align:center" + ">Application Type - Additional Terminal/mPOS Reader</th>"	
					+ "</tr>"
					+ "<tr>"
					+ "<th>Pre-Approved</th>"
					+ "<th>Document and Credit Check</th>"
					+ "<th>Decisioning</th>"
					+ "<th>Approve, to issue New Letter of Acceptance</th>"
					+ "<th>Approved. Request for MID Setup</th>"
					+ "<th>Decline</th>"
					+ "<th>Close-Cancel</th>"
					+ "<th>Close-Withdrawn</th>"
					+ "<th>Pending Verification </th>"
					+ "<th>Pending Installation</th>"
					+ "<th>Terminal Installed</th>"
					+ "<th>Total</th>"
					+ "</tr>"
					+"</thead><tbody>";
		
				int n = 0;
				int sum_TotalSubmission = 0;
				int sum_c = 0;
				int sum_d = 0;
				int sum_e = 0;
				int sum_f = 0;
				int sum_g = 0;
				int sum_h = 0;
				int sum_i = 0;
				int sum_j = 0;
				int sum_k = 0;
				int sum_l = 0;
				int sum_m = 0;
				int sum_TotalWork = 0;
		
				for(TreeMap<String, String> c : (ArrayList<TreeMap<String, String>>) cArrAddtion){
					sum_TotalSubmission += c.get("total_submission") != null ?Integer.parseInt(c.get("total_submission")): 0;
					sum_c += c.get("col_c") != null ? Integer.parseInt(c.get("col_c")): 0;
					sum_d += c.get("col_d") != null ? Integer.parseInt(c.get("col_d")): 0;
					sum_e += c.get("col_e") != null ? Integer.parseInt(c.get("col_e")): 0;
					sum_f += c.get("col_f") != null ? Integer.parseInt(c.get("col_f")): 0;
					sum_g += c.get("col_g") != null ? Integer.parseInt(c.get("col_g")): 0;
					sum_h += c.get("col_h") != null ? Integer.parseInt(c.get("col_h")): 0;
					sum_i += c.get("col_i") != null ? Integer.parseInt(c.get("col_i")): 0;
					sum_j += c.get("col_j") != null ? Integer.parseInt(c.get("col_j")): 0;
					sum_k += c.get("col_k") != null ? Integer.parseInt(c.get("col_k")): 0;
					sum_l += c.get("col_l") != null ? Integer.parseInt(c.get("col_l")): 0;
					sum_m += c.get("col_m") != null ? Integer.parseInt(c.get("col_m")): 0;
					sum_TotalWork += c.get("total") != null ? Integer.parseInt(c.get("total")): 0;
				
					html += "<tr class=" + (n % 2 > 0 ? "alt" : "even") + ">"
						+ "	<td>" + (c.get("group") != null ? Encode.forHtml(c.get("group")) : "") + "</td>"
						+ "	<td>" + (c.get("total_submission") != null ? Encode.forHtml(c.get("total_submission")) : "") + "</td>"
						+ "	<td>" + (c.get("col_c") != null ? Encode.forHtml(c.get("col_c")) : "") + "</td>"
						+ "	<td>" + (c.get("col_d") != null ? Encode.forHtml(c.get("col_d")) : "") + "</td>"
						+ "	<td>" + (c.get("col_e") != null ? Encode.forHtml(c.get("col_e")) : "") + "</td>"
						+ "	<td>" + (c.get("col_f") != null ? Encode.forHtml(c.get("col_f")) : "") + "</td>"
						+ "	<td>" + (c.get("col_g") != null ? Encode.forHtml(c.get("col_g")) : "") + "</td>"
						+ "	<td>" + (c.get("col_h") != null ? Encode.forHtml(c.get("col_h")) : "") + "</td>"
						+ "	<td>" + (c.get("col_i") != null ? Encode.forHtml(c.get("col_i")) : "") + "</td>"
						+ "	<td>" + (c.get("col_j") != null ? Encode.forHtml(c.get("col_j")) : "")  + "</td>"
						+ "	<td>" + (c.get("col_k") != null ? Encode.forHtml(c.get("col_k")) : "")  + "</td>"
						+ "	<td>" + (c.get("col_l") != null ? Encode.forHtml(c.get("col_l")) : "")  + "</td>"
						+ "	<td>" + (c.get("col_m") != null ? Encode.forHtml(c.get("col_m")) : "")  + "</td>"
						+ "	<td>" + (c.get("total") != null ? Encode.forHtml(c.get("total")) : "")  + "</td>"
						+ "</tr>";
				
					++n;
				}
				html += "<tr class=" + (n % 2 > 0 ? "alt" : "even") + ">";
				html += "<td>Total</td>";
				html += "<td>"+sum_TotalSubmission+"</td>";
				html += "<td>"+sum_c+"</td>";
				html += "<td>"+sum_d+"</td>";
				html += "<td>"+sum_e+"</td>";
				html += "<td>"+sum_f+"</td>";
				html += "<td>"+sum_g+"</td>";
				html += "<td>"+sum_h+"</td>";
				html += "<td>"+sum_i+"</td>";
				html += "<td>"+sum_j+"</td>";
				html += "<td>"+sum_k+"</td>";
				html += "<td>"+sum_l+"</td>";
				html += "<td>"+sum_m+"</td>";
				html += "<td>"+sum_TotalWork+"</td></tr>";
		
				html +="</tbody></table></div>";
				out.println(html);
			}					
		%>
		
		<!-- Grand Total -->
		<%
			ArrayList<TreeMap<String, String>> cArrGrand = t.get("Grand Total");
			if(cArrGrand != null && cArrGrand.size() > 0){
		
				html = "<div style="+"width:1200px; overflow-x:auto" +">"
					+ "<table class=" + "tblDetails reportTbl" +"><thead>"
					+ "<tr>"
					+ "<th></th>"
					+ "<th>Total Submission</th>"
					+ "<th>Pre-Approved</th>"
					+ "<th>Document and Credit Check</th>"
					+ "<th>Decisioning</th>"
					+ "<th>Approve, to issue New Letter of Acceptance</th>"
					+ "<th>Approved. Request for MID Setup</th>"
					+ "<th>Decline</th>"
					+ "<th>Close-Cancel</th>"
					+ "<th>Close-Withdrawn</th>"
					+ "<th>Pending Verification </th>"
					+ "<th>Pending Installation</th>"
					+ "<th>Terminal Installed</th>"
					+ "<th>Total</th>"
					+ "</tr>"
					+"</thead><tbody>";
		
				int n = 0;
				for(TreeMap<String, String> c : (ArrayList<TreeMap<String, String>>) cArrGrand){
				
					html += "<tr class=" + (n % 2 > 0 ? "alt" : "even") + ">"
						+ "	<td>Grand Total</td>"
						+ "	<td>" + (c.get("gTotalSummission") != null ? Encode.forHtml(c.get("gTotalSummission")) : "") + "</td>"
						+ "	<td>" + (c.get("gTotalCol_C") != null ? Encode.forHtml(c.get("gTotalCol_C")) : "") + "</td>"
						+ "	<td>" + (c.get("gTotalCol_D") != null ? Encode.forHtml(c.get("gTotalCol_D")) : "") + "</td>"
						+ "	<td>" + (c.get("gTotalCol_E") != null ? Encode.forHtml(c.get("gTotalCol_E")) : "") + "</td>"
						+ "	<td>" + (c.get("gTotalCol_F") != null ? Encode.forHtml(c.get("gTotalCol_F")) : "") + "</td>"
						+ "	<td>" + (c.get("gTotalCol_G") != null ? Encode.forHtml(c.get("gTotalCol_G")) : "") + "</td>"
						+ "	<td>" + (c.get("gTotalCol_H") != null ? Encode.forHtml(c.get("gTotalCol_H")) : "") + "</td>"
						+ "	<td>" + (c.get("gTotalCol_I") != null ? Encode.forHtml(c.get("gTotalCol_I")) : "") + "</td>"
						+ "	<td>" + (c.get("gTotalCol_J") != null ? Encode.forHtml(c.get("gTotalCol_J")) : "")  + "</td>"
						+ "	<td>" + (c.get("gTotalCol_K") != null ? Encode.forHtml(c.get("gTotalCol_K")) : "")  + "</td>"
						+ "	<td>" + (c.get("gTotalCol_L") != null ? Encode.forHtml(c.get("gTotalCol_L")) : "")  + "</td>"
						+ "	<td>" + (c.get("gTotalCol_M") != null ? Encode.forHtml(c.get("gTotalCol_M")) : "")  + "</td>"
						+ "	<td>" + (c.get("gTotalWork") != null ? Encode.forHtml(c.get("gTotalWork")) : "")  + "</td>"
						+ "</tr>";
				
					++n;
				}
				
				html +="</tbody></table></div>";
				out.println(html);
			}					
		}
		%>
		
		<%
		ArrayList<TreeMap<String, String>> cArr = (ArrayList<TreeMap<String, String>>) request.getAttribute("cArr");
		if(cArr != null && cArr.size() > 0){
			String type = "";
			if(search.containsKey("application_type")){
				type = search.get("application_type");
			} else {
				type = "All";
			}
			String matrix = "";
			if(search.containsKey("matrix")){
				matrix = search.get("matrix");
			} 
			
			html = "<div style="+"width:1200px; overflow-x:auto" +">"
				+ "<table class=" + "tblDetails reportTbl" +"><thead>"
				+ "<tr>"
				+ "<th rowspan="+ "2" + " >Group</th>"
				+ "<th rowspan="+ "2" +">Total Submission</th>"
				+ "<th colspan=" + "12" + " style=" + "text-align:center" + ">"+ type + " - " + matrix + "</th>"
				+ "</tr>"
				+ "<tr>"
				+ "<th>Pre-Approved</th>"
				+ "<th>Document and Credit Check</th>"
				+ "<th>Decisioning</th>"
				+ "<th>Approve, to issue New Letter of Acceptance</th>"
				+ "<th>Approved. Request for MID Setup</th>"
				+ "<th>Decline</th>"
				+ "<th>Close-Cancel</th>"
				+ "<th>Close-Withdrawn</th>"
				+ "<th>Pending Verification </th>"
				+ "<th>Pending Installation</th>"
				+ "<th>Terminal Installed</th>"
				+ "<th>Total</th>"
				+ "</tr>"
				+"</thead><tbody>";
			
			int n = 0;
			int sum_TotalSubmission = 0;
			int sum_c = 0;
			int sum_d = 0;
			int sum_e = 0;
			int sum_f = 0;
			int sum_g = 0;
			int sum_h = 0;
			int sum_i = 0;
			int sum_j = 0;
			int sum_k = 0;
			int sum_l = 0;
			int sum_m = 0;
			int sum_TotalWork = 0;
			
			for(TreeMap<String, String> c : (ArrayList<TreeMap<String, String>>) cArr){
				sum_TotalSubmission += c.get("total_submission") != null ?Integer.parseInt(c.get("total_submission")): 0;
				sum_c += c.get("col_c") != null ? Integer.parseInt(c.get("col_c")): 0;
				sum_d += c.get("col_d") != null ? Integer.parseInt(c.get("col_d")): 0;
				sum_e += c.get("col_e") != null ? Integer.parseInt(c.get("col_e")): 0;
				sum_f += c.get("col_f") != null ? Integer.parseInt(c.get("col_f")): 0;
				sum_g += c.get("col_g") != null ? Integer.parseInt(c.get("col_g")): 0;
				sum_h += c.get("col_h") != null ? Integer.parseInt(c.get("col_h")): 0;
				sum_i += c.get("col_i") != null ? Integer.parseInt(c.get("col_i")): 0;
				sum_j += c.get("col_j") != null ? Integer.parseInt(c.get("col_j")): 0;
				sum_k += c.get("col_k") != null ? Integer.parseInt(c.get("col_k")): 0;
				sum_l += c.get("col_l") != null ? Integer.parseInt(c.get("col_l")): 0;
				sum_m += c.get("col_m") != null ? Integer.parseInt(c.get("col_m")): 0;
				sum_TotalWork += c.get("total") != null ? Integer.parseInt(c.get("total")): 0;
				
				html += "<tr class=" + (n % 2 > 0 ? "alt" : "even") + ">"
				+ "	<td>" + (c.get("group") != null ? Encode.forHtml(c.get("group")) : "") + "</td>"
				+ "	<td>" + (c.get("total_submission") != null ? Encode.forHtml(c.get("total_submission")) : "") + "</td>"
				+ "	<td>" + (c.get("col_c") != null ? Encode.forHtml(c.get("col_c")) : "") + "</td>"
				+ "	<td>" + (c.get("col_d") != null ? Encode.forHtml(c.get("col_d")) : "") + "</td>"
				+ "	<td>" + (c.get("col_e") != null ? Encode.forHtml(c.get("col_e")) : "") + "</td>"
				+ "	<td>" + (c.get("col_f") != null ? Encode.forHtml(c.get("col_f")) : "") + "</td>"
				+ "	<td>" + (c.get("col_g") != null ? Encode.forHtml(c.get("col_g")) : "") + "</td>"
				+ "	<td>" + (c.get("col_h") != null ? Encode.forHtml(c.get("col_h")) : "") + "</td>"
				+ "	<td>" + (c.get("col_i") != null ? Encode.forHtml(c.get("col_i")) : "") + "</td>"
				+ "	<td>" + (c.get("col_j") != null ? Encode.forHtml(c.get("col_j")) : "")  + "</td>"
				+ "	<td>" + (c.get("col_k") != null ? Encode.forHtml(c.get("col_k")) : "")  + "</td>"
				+ "	<td>" + (c.get("col_l") != null ? Encode.forHtml(c.get("col_l")) : "")  + "</td>"
				+ "	<td>" + (c.get("col_m") != null ? Encode.forHtml(c.get("col_m")) : "")  + "</td>"
				+ "	<td>" + (c.get("total") != null ? Encode.forHtml(c.get("total")) : "")  + "</td>"
				+ "</tr>";
				
				++n;
			}
			html += "<tr class=" + (n % 2 > 0 ? "alt" : "even") + ">";
			html += "<td>Total</td>";
			html += "<td>"+sum_TotalSubmission+"</td>";
			html += "<td>"+sum_c+"</td>";
			html += "<td>"+sum_d+"</td>";
			html += "<td>"+sum_e+"</td>";
			html += "<td>"+sum_f+"</td>";
			html += "<td>"+sum_g+"</td>";
			html += "<td>"+sum_h+"</td>";
			html += "<td>"+sum_i+"</td>";
			html += "<td>"+sum_j+"</td>";
			html += "<td>"+sum_k+"</td>";
			html += "<td>"+sum_l+"</td>";
			html += "<td>"+sum_m+"</td>";
			html += "<td>"+sum_TotalWork+"</td></tr>";
			html +="</tbody></table></div>";
			out.println(html);
		}
		%>
		
		<%-- <div style="width:1200px; overflow-x:auto">
		<table class="tblDetails reportTbl"><thead>
			<tr>
				<th rowspan="2" >Group</th>
				<th rowspan="2">Total Submission</th>
				<%
				
					String type = "";
					if(search.containsKey("application_type")){
						type = search.get("application_type");
					} else {
						type = "All";
					}
					String matrix = "";
					if(search.containsKey("matrix")){
						matrix = search.get("matrix");
					} 
				%>
				<th colspan="12" style="text-align:center"><%="".equals(type)?"All":type %> <%=("".equals(matrix)? matrix : "(" + matrix + ")") %></th>
			</tr>
			<tr>
				<th>Approve, to issue New Letter of Acceptance</th>
				<th>Approved, Request for Cardlink Update</th>
				<th>Recommend</th>
				<th>Decline</th>
				<th>Close-cancel</th>
				<th>Close-withdrawn</th>
				<th>Close-reject</th>
				<th>Reject Data Discrepancy</th>
				<th>Reject-Doc Discrepancy</th>
				<th>Reject-Data & Doc Discrepancy</th>
				<th>Normal close</th>
				<th>Total</th>
			</tr>
		</thead><tbody>
		<%
			int n = 0;
			for(TreeMap<String, String> c : (ArrayList<TreeMap<String, String>>) request.getAttribute("cArr")){
				//String case_url = request.getContextPath() + "/NewApp.do?dispatch=init&m_id=" + c.getMerchant().getId() + "&c_id=" + c.getId();
				
				html = "<tr class=" + (n % 2 > 0 ? "alt" : "even") + ">"
				+ "	<td>" + (c.get("group") != null ? Encode.forHtml(c.get("group")) : "") + "</td>"
				+ "	<td>" + (c.get("total_submission") != null ? Encode.forHtml(c.get("total_submission")) : "") + "</td>"
				+ "	<td>" + (c.get("col_c") != null ? Encode.forHtml(c.get("col_c")) : "") + "</td>"
				+ "	<td>" + (c.get("col_d") != null ? Encode.forHtml(c.get("col_d")) : "") + "</td>"
				+ "	<td>" + (c.get("col_e") != null ? Encode.forHtml(c.get("col_e")) : "") + "</td>"
				+ "	<td>" + (c.get("col_f") != null ? Encode.forHtml(c.get("col_f")) : "") + "</td>"
				+ "	<td>" + (c.get("col_g") != null ? Encode.forHtml(c.get("col_g")) : "") + "</td>"
				+ "	<td>" + (c.get("col_h") != null ? Encode.forHtml(c.get("col_h")) : "") + "</td>"
				+ "	<td>" + (c.get("col_i") != null ? Encode.forHtml(c.get("col_i")) : "") + "</td>"
				+ "	<td>" + (c.get("col_j") != null ? Encode.forHtml(c.get("col_j")) : "")  + "</td>"
				+ "	<td>" + (c.get("col_k") != null ? Encode.forHtml(c.get("col_k")) : "")  + "</td>"
				+ "	<td>" + (c.get("col_l") != null ? Encode.forHtml(c.get("col_l")) : "")  + "</td>"
				+ "	<td>" + (c.get("col_m") != null ? Encode.forHtml(c.get("col_m")) : "")  + "</td>"
				+ "	<td>" + (c.get("total") != null ? Encode.forHtml(c.get("total")) : "")  + "</td>"
				+ "</tr>";
				
				out.println(html);
				++n;
			}
		%>
		</tbody></table>
		
		</div>
		 --%>
	</div>
</div>

<!-- Footer -->
<%@ include file="/jsp/common/Footer.jsp" %>	
<!-- End Footer -->


</body>
</html>